//
//  AddressViewCell.m
//  ShrimpCrowdordering
//
//  Created by 骆锴 on 2018/8/30.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "AddressViewCell.h"
#import "AddressManagerModel.h"

@interface AddressViewCell()

@property (nonatomic, strong) UILabel *consignee;
@property (nonatomic, strong) UILabel *phone;
@property (nonatomic, strong) UILabel *address;

@end

@implementation AddressViewCell

+ (AddressViewCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"addressCell";
    AddressViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[AddressViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    return cell;
}

-(void)createSubView{
    UIImageView *top = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(0), ScreenX375(0), SCREEN_WIDTH, ScreenX375(4))];
    top.image = ImageWithName(@"组19");
    [self addSubview:top];
    
    _consignee =[[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(16), ScreenX375(15), ScreenX375(100), ScreenX375(17))];
    _consignee.text = @"收货人：王林";
    _consignee.font = Kfont(12);
    _consignee.textColor = REXADECIMALCOLOR(@"#333333");
    _consignee.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_consignee];
    
    _phone =[[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(251), ScreenX375(15), ScreenX375(100), ScreenX375(17))];
    _phone.text = @"13588292524";
    _phone.font = Kfont(12);
    _phone.textColor = REXADECIMALCOLOR(@"#333333");
    _phone.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_phone];
    
    _address =[[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(16), ScreenX375(38), ScreenX375(316), ScreenX375(34))];
    _address.text = @"收货地址：浙江省余杭区五常大道168号西溪软件园处女座B1座4层";
    _address.font = Kfont(12);
    _address.numberOfLines = 2;
    _address.textColor = REXADECIMALCOLOR(@"#333333");
    _address.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_address];
    
    UIImageView *more = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(353), ScreenX375(40), ScreenX375(7), ScreenX375(12))];
    more.image = ImageWithName(@"更多");
    [self addSubview:more];
}

-(void)initWithModel:(AddressManagerModel *)model{
    _consignee.text = [NSString stringWithFormat:@"收货人: %@",model.recName];
    _phone.text = [NSString stringWithFormat:@"%@",model.recPhone];
    _address.text = [NSString stringWithFormat:@"%@%@%@%@",model.recProvince,model.recCity,model.recArea,model.recAddress];
}

@end

